Skip to content

feat(Logic/Function/Defs): add Function.diag#41082

Open
wrenna-robson wants to merge 13 commits into
leanprover-community:masterfrom
wrenna-robson:function_diag
Open

feat(Logic/Function/Defs): add Function.diag#41082
wrenna-robson wants to merge 13 commits into
leanprover-community:masterfrom
wrenna-robson:function_diag

Conversation

@wrenna-robson

Copy link
Copy Markdown
Collaborator

Adds a name and notation for the function fun x => (x, x).


Open in Gitpod

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

PR summary 331c8c5dca

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ continuous_diag
+ diag_apply
+ diag_comp
+ diag_def
+ fst_comp_diag
+ injective_diag
+ map_comp_diag
+ measurable_diag
+ measurable_diag'
+ prod_id_id
+ snd_comp_diag
+ swap_comp_diag
+-+ diag

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 331c8c5).

  • +14 new declarations
  • −0 removed declarations
+Function.diag
+Function.diag_apply
+Function.diag_comp
+Function.diag_def
+Function.fst_comp_diag
+Function.injective_diag
+Function.map_comp_diag
+Function.prod_id_id
+Function.snd_comp_diag
+Function.swap_comp_diag
+Function.«term△(_)»
+continuous_diag
+measurable_diag
+measurable_diag'

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 331c8c5dca
Reference commit c108fbdaf5

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@wrenna-robson wrenna-robson changed the title feat(Logic/Function/Defs): Add Function.diag feat(Logic/Function/Defs): add Function.diag Jun 26, 2026
/-- The diagonal map into `Prod`. -/
@[inline] protected def diag {α} : α → α × α := Function.prod id id

@[inherit_doc] notation:max "△(" x:min ")" => Function.diag x

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you discussed adding this notation on Zulip?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a discussion in https://leanprover.zulipchat.com/#narrow/channel/144837-PR-reviews/topic/.2337631.3A.20Function.2Eprod.20and.20related.20definitions/with/593475546 - this PR is the result of me separating that larger PR into smaller pieces.

Comment thread Mathlib/Logic/Function/Defs.lean Outdated
@wrenna-robson

Copy link
Copy Markdown
Collaborator Author

See https://leanprover.zulipchat.com/#narrow/channel/144837-PR-reviews/topic/.2341082.2C.20.2341147.2C.20.2341148.20etc.2E.3A.20Function.2Eprod.20and.20friends/with/607343481 for a discussion of this and related PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants